using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;

namespace BTSProjectWizard.Forms
{
    public partial class PipelinePickerPage : BTSProjectWizard.BTSWizardPage
    {
        public PipelinePickerPage()
        {
            InitializeComponent();
        }
        public override bool ProcessSymbols()
        {
            
            wizard.AddSymbol("pipelineType", comboBox1.SelectedItem.ToString());
            Type t = comboBox1.SelectedItem as Type;
            if (t.BaseType.ToString().Contains("ReceivePipeline"))
                wizard.AddSymbol("Receive", true);
            else
                wizard.AddSymbol("Send", true);
            Reference r = new Reference();
            r.Path = _assembly.Text;
            wizard.Info.References.Add(r);
            return true;
        }

        private void label1_Click(object sender, EventArgs e)
        {

        }

        private void _assembly_TextChanged(object sender, EventArgs e)
        {

        }

        private void _findAssembly_Click(object sender, EventArgs e)
        {
            DialogResult dr = openFileDialog1.ShowDialog();
            if (dr == DialogResult.OK)
            {
               
                string fn = openFileDialog1.FileName;
                _assembly.Text = fn;
                List<Type> pipelines =  this.GetPipelines(fn);
                foreach (Type t in pipelines)
                {
                    comboBox1.Items.Add(t);
                   
                }
            }
        }
    }
}

